package com.my.chapter9;

public class practice9 {
    public static void main(String[] args) {
        Music5.main(args);
    }
}

interface Instrument{
    int VALUE = 5;
    void play();
}

abstract class P09{
    abstract void adjust();
}

class Wind extends P09 implements Instrument{

    @Override
    public void play() {
        System.out.println(this + ".play()" +VALUE);
    }

    @Override
    void adjust() {
        System.out.println(this +".adjust()");
    }

    @Override
    public String toString() {
        return "Wind";
    }
}

class Percussion extends P09 implements Instrument{

    @Override
    public void play() {
        System.out.println(this + ".play()" +VALUE);
    }

    @Override
    void adjust() {
        System.out.println(this +".adjust()");
    }

    @Override
    public String toString() {
        return "Percussion";
    }
}

class Stringed extends P09 implements Instrument{

    @Override
    public void play() {
        System.out.println(this + ".play()" +VALUE);
    }

    @Override
    void adjust() {
        System.out.println(this +".adjust()");
    }

    @Override
    public String toString() {
        return "Stringed";
    }
}

class Brass extends Wind{
    @Override
    public String toString() {
        return "Brass";
    }
}

class Woodwind extends Wind{
    @Override
    public String toString() {
        return "Woodwind";
    }
}

class Music5{
    static void tune(Instrument i){
        i.play();
    }
    static void tuneAll(Instrument[] e){
        for(Instrument i:e){
            tune(i);
        }
    }

    public static void main(String[] args) {
        Instrument[] orchestra = {
                new Wind(),
                new Percussion(),
                new Stringed(),
                new Brass(),
                new Woodwind()
        };
        tuneAll(orchestra);
    }
}



